package com.sky.mapper;

import com.sky.annotation.AutoInsertFill;
import com.sky.annotation.AutoUpdateFill;
import com.sky.entity.Employee;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface EmployeeMapper {

    /**
     * 根据用户名查询员工
     * @param username
     * @return
     */
    @Select("select * from employee where username = #{username}")
    Employee getByUsername(String username);

    /**
     * 选择计数
     *
     * @param employeeQuery 员工查询
     * @return {@link Integer}
     */

    Integer selectCount(Employee employeeQuery);

    /**
     * 新增
     *
     * @param employee 受雇者
     */
    @AutoInsertFill
    void insert(Employee employee);

    /**
     * 选择列表
     *
     * @param employeeQuery 员工查询
     * @return {@link List}<{@link Employee}>
     */
    List<Employee> selectList(Employee employeeQuery);

    /**
     * 按id更新
     *
     * @param employee 受雇者
     */
    @AutoUpdateFill
    void updateById(Employee employee);

    /**
     * 按id选择
     *
     * @param id 身份证件
     * @return {@link Employee}
     */
    Employee selectById(Long id);
}
